package com.neutech.maplestory.util;

import java.awt.*;
import java.util.HashMap;
import java.util.Map;

/**
 * 静态加载项目中所有资源
 */
public class ImageUtil {
    public static Map<String, Image> imageMap = new HashMap<>();
    static {
        //LOGO
        imageMap.put("logo",GameUtil.getImage("icon/logo"));
        //英雄朝右站立
        for (int i = 0; i < 4; i++) {
            imageMap.put("hero_right_stand" + i,GameUtil.getImage("hero/right/stand/stand1_" + i));
        }
        //英雄朝左站立
        for (int i = 0; i < 4; i++) {
            imageMap.put("hero_left_stand" + i,GameUtil.getImage("hero/left/stand/stand1_" + i));
        }
        //英雄朝右走
        for (int i = 0; i < 5; i++) {
            imageMap.put("hero_right_walk" + i,GameUtil.getImage("hero/right/walk/walk1_" + i));
        }
        //英雄向左走
        for (int i = 0; i < 5; i++) {
            imageMap.put("hero_left_walk" + i,GameUtil.getImage("hero/left/walk/walk1_" + i));
        }
        //向左向右趴下
        imageMap.put("hero_right_prone",GameUtil.getImage("hero/right/prone/prone_0"));
        imageMap.put("hero_left_prone",GameUtil.getImage("hero/left/prone/prone_0"));
        //向左右跳
        imageMap.put("hero_right_jump",GameUtil.getImage("hero/right/jump/jump_0"));
        imageMap.put("hero_left_jump",GameUtil.getImage("hero/left/jump/jump_0"));

        //左右射击
        for (int i = 0; i < 4; i++) {
            imageMap.put("hero_right_shoot" + i,GameUtil.getImage("hero/right/shoot/shoot1_" + i));
        }
        for (int i = 0; i < 4; i++) {
            imageMap.put("hero_left_shoot" + i,GameUtil.getImage("hero/left/shoot/shoot1_" + i));
        }
        //射出的箭
        imageMap.put("hero_right_arrow",GameUtil.getImage("arrow/right/hero_arrow"));
        imageMap.put("hero_left_arrow",GameUtil.getImage("arrow/left/hero_arrow"));
        //怪站着
        for (int i = 0; i < 3; i++) {
            imageMap.put("mob01_left_stand"+i,GameUtil.getImage("mob/mob01/left/stand/" + i));
        }
        for (int i = 0; i < 3; i++) {
            imageMap.put("mob01_right_stand"+i,GameUtil.getImage("mob/mob01/right/stand/" + i));
        }
        //怪走
        for (int i = 0; i < 2; i++) {
            imageMap.put("mob01_left_walk"+i,GameUtil.getImage("mob/mob01/left/walk/" + i));
        }
        for (int i = 0; i < 2; i++) {
            imageMap.put("mob01_right_walk"+i,GameUtil.getImage("mob/mob01/right/walk/" + i));
        }
        //怪死
        for (int i = 0; i < 4; i++) {
            imageMap.put("mob01_left_die"+i,GameUtil.getImage("mob/mob01/left/die/" + i));
        }
        for (int i = 0; i < 4; i++) {
            imageMap.put("mob01_right_die"+i,GameUtil.getImage("mob/mob01/right/die/" + i));
        }
        //普通小怪的血块
        imageMap.put("blood",GameUtil.getImage("blood/blood"));
        //人物 蓝
        imageMap.put("mp",GameUtil.getImage("blood/mp"));
        //道具
        imageMap.put("HP_50",GameUtil.getImage("item/HP_50"));
        imageMap.put("HP_100",GameUtil.getImage("item/HP_100"));
        imageMap.put("HP_300",GameUtil.getImage("item/HP_300"));
        imageMap.put("MP_100",GameUtil.getImage("item/MP_100"));
        imageMap.put("itemPackage",GameUtil.getImage("itempackage/ItemPackage"));
        for (int i = 0; i < 10; i++) {
            imageMap.put("power" +i,GameUtil.getImage("power/" + i));
        }
        imageMap.put("bg",GameUtil.getImage("background/maple"));
        imageMap.put("lefthit",GameUtil.getImage("mob/mob01/left/hit/0"));
        imageMap.put("righthit",GameUtil.getImage("mob/mob01/right/hit/0"));
        imageMap.put("rope",GameUtil.getImage("hero/rope"));
        imageMap.put("bg1",GameUtil.getImage("background/1"));



    }
    private ImageUtil(){};

    /**
     * 通过图片对象的key获取图片对象
     * @param key 键
     * @return 图片对象
     */
    public static Image getImage(String key){
        return imageMap.get(key);
    }
}
